// 修复iphone部分机型渲染失败的bug
if (tt.getSystemInfoSync().platform.toLocaleLowerCase() === 'ios') {
    let originCreateCanvas = tt.createCanvas;
    tt.createCanvas = (...args) => {
        let canvas = originCreateCanvas.apply(wx, args);
        let originGetContext = canvas.getContext;
        canvas.getContext = (...args) => {
            let ctx = originGetContext.apply(canvas, args);
            if (args[0] == 'webgl') {
                let proxyHandler = {
                    get: function (obj, value) {
                        if (typeof obj[value] === 'function') {
                            let originFn = ctx[value];
                            function wrapFn(...args) {
                                if (value === 'deleteBuffer') {
                                    return () => {
                                        let ret = originFn.apply(ctx, args);
                                        return ret;
                                    };
                                }
                                let ret = originFn.apply(ctx, args);
                                return ret;
                            }
                            let fn = wrapFn.bind(ctx);
                            return fn;
                        } else {
                            return obj[value];
                        }
                    },
                    set: function (obj, prop, value) {
                        obj[prop] = value;
                        return true;
                    }
                };
                let proxyCtx = new Proxy(ctx, proxyHandler);
                return proxyCtx;
            }
            return ctx;
        }
        return canvas;
    }
}
require("./weapp-adapter");
window.config = require('./config');
window.Parser=require("./js/dom_parser");
window.loadLib=require;
require("./libs/laya.ttmini.js");
require("./index");